/*
 * RMMockUserTransactionManager.java    ver   29/nov/2009
 *
 * Copyright (c) 2009 mentalsmash.org
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * The use of the Apache License does not indicate that this project is
 * affiliated with the Apache Software Foundation.
 */
package org.mentalsmash.tazio.transactions.management.rm;

import java.util.concurrent.Future;

import org.mentalsmash.tazio.transactions.RollbackException;
import org.mentalsmash.tazio.transactions.Transaction;
import org.mentalsmash.tazio.transactions.TransactionStatus;
import org.mentalsmash.tazio.transactions.TransactionalSystemException;
import org.mentalsmash.tazio.transactions.UserTransactionManager;
import org.mentalsmash.tazio.transactions.log.TransactionsLog;
import org.mentalsmash.tazio.transactions.management.SystemTransactionManager;
import org.mentalsmash.tazio.transactions.management.TransactionRemotizationException;
import org.mentalsmash.tazio.transactions.management.TransactionStateException;
import org.mentalsmash.tazio.transactions.management.ValidationAgent;

import com.google.inject.Singleton;

/**
 * This class is here just for matters of a poor dependency design. This class
 * should actually never get used
 * 
 * @version ver 29/nov/2009
 * @author Andrea Reale <andrea.reale@gmail.com>
 * 
 */
@Singleton
public class RMMockUserTransactionManager implements UserTransactionManager,
	SystemTransactionManager {

    /*
     * (non-Javadoc)
     * 
     * @see org.mentalsmash.tazio.transactions.UserTransactionManager#begin()
     */
    @Override
    public Transaction begin() throws TransactionStateException,
	    TransactionRemotizationException {
	throw new UnsupportedOperationException("Mock class!");
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.mentalsmash.tazio.transactions.UserTransactionManager#beginReadOnly()
     */
    @Override
    public Transaction beginReadOnly() {
	throw new UnsupportedOperationException("Mock class!");
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.mentalsmash.tazio.transactions.UserTransactionManager#getTransaction
     * ()
     */
    @Override
    public Transaction getTransaction() {
	throw new UnsupportedOperationException("Mock class!");
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.mentalsmash.tazio.transactions.management.SystemTransactionManager
     * #commit()
     */
    @Override
    public void commit() throws RollbackException, TransactionStateException,
	    TransactionalSystemException {
	throw new UnsupportedOperationException("Mock class!");

    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.mentalsmash.tazio.transactions.management.SystemTransactionManager
     * #commitAsync()
     */
    @Override
    public Future<TransactionStatus> commitAsync()
	    throws TransactionStateException {
	throw new UnsupportedOperationException("Mock class!");
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.mentalsmash.tazio.transactions.management.SystemTransactionManager
     * #getStatus()
     */
    @Override
    public TransactionStatus getStatus() {
	throw new UnsupportedOperationException("Mock class!");
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.mentalsmash.tazio.transactions.management.SystemTransactionManager
     * #getTransactionsLog()
     */
    @Override
    public TransactionsLog getTransactionsLog() {
	throw new UnsupportedOperationException("Mock class!");
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.mentalsmash.tazio.transactions.management.SystemTransactionManager
     * #getValidationAgent()
     */
    @Override
    public ValidationAgent getValidationAgent() {
	throw new UnsupportedOperationException("Mock class!");
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * org.mentalsmash.tazio.transactions.management.SystemTransactionManager
     * #rollback()
     */
    @Override
    public void rollback() throws TransactionStateException {
	throw new UnsupportedOperationException("Mock class!");

    }

    public int getNumLocalRollbacks() {
	return -1;
    }

}
